import request from "@/utils/request";
import { StoreAccountForm } from "./types";
import { AxiosPromise } from "axios";
import {StoreAccountQuery} from "@/api/storeAccount/types";

/**
 * 店铺分页数据
 *
 * @param queryParams
 */
export function getStoreAccountPage(
	queryParams: StoreAccountQuery
): AxiosPromise<PageResult<[]>> {
	return request({
		url: '/api/v1/storeAccount/page',
		method: 'get',
		params: queryParams
	});
}

/**
 * 获取店铺表单数据
 *
 * @param queryParams
 */
export function getStoreAccountForm(id: number): AxiosPromise<StoreAccountForm> {
	return request({
		url: '/api/v1/storeAccount/' + id + '/form',
		method: 'get'
	});
}

/**
 * 保存店铺
 *
 * @param data
 */
export function saveStoreAccount(data: StoreAccountForm) {
  return request({
    url: "/api/v1/storeAccount",
    method: "post",
    data: data,
  });
}

/**
 * 删除店铺
 *
 * @param ids
 */
export function deleteStoreAccount(ids: string) {
	return request({
		url: '/api/v1/storeAccount/' + ids,
		method: 'delete'
	});
}
